package com.xpffly.design.template;

/**
 * @Author: xpengfei
 * @Date: 2021/3/28 13:30
 * @Description：悍马 H1 模型，喇叭想让他响他就响
 */
public class HummerH1Model extends HummerTemplate {
    /**
     * 默认响喇叭
     */
    private boolean alarmFlag = true;

    @Override
    protected void start() {
        System.out.println("悍马 H1 启动...");
    }

    @Override
    protected void stop() {
        System.out.println("悍马 H1 停止...");
    }

    @Override
    protected void alarm() {
        System.out.println("悍马 H1 鸣笛...");
    }

    @Override
    protected void engineBoom() {
        System.out.println("悍马 H1 引擎声音...");
    }

    public void setAlarmFlag(boolean alarmFlag) {
        this.alarmFlag = alarmFlag;
    }

    /**
     * 决定是否鸣笛
     *
     * @return
     */
    @Override
    protected boolean isAlarm() {
        return this.alarmFlag;
    }
}
